package com.springboot.service.impl;

import com.springboot.mapper.AssistantListFormMapper;
import com.springboot.mapper.UserLoginFormMapper;
import com.springboot.model.AssistantListFormKey;
import com.springboot.model.UserLoginForm;
import com.springboot.service.DoctorViewNewAssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * 用于医生查看不属于自己的助理列表
 */
@Service
public class DoctorViewNewAssistantServiceImpl implements DoctorViewNewAssistantService {
    @Autowired
    private UserLoginFormMapper userLoginFormMapper;
    @Autowired
    private AssistantListFormMapper assistantListFormMapper;

    //通过手机号查找用户
    @Override
    public UserLoginForm findUserByTel(String tel)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByTel(tel);
        return userLoginForm;
    }

    //通过医生id查找属于自己的助理列表
    @Override
    public ArrayList<AssistantListFormKey> findAssistantByDoctor(Integer doctorId)
    {
        ArrayList<AssistantListFormKey> assistantListFormKeys=assistantListFormMapper.findAssistantById(doctorId);
        return assistantListFormKeys;
    }

    //查找用户表中的所有助理id
    @Override
    public ArrayList<UserLoginForm> findAssistantByType(Integer userType)
    {
        ArrayList<UserLoginForm> userLoginForms=userLoginFormMapper.selectByType(userType);
        return userLoginForms;
    }

    //通过用户id查找用户
    @Override
    public UserLoginForm findAssistantById(Integer assistantId)
    {
        UserLoginForm userLoginForm=userLoginFormMapper.selectByPrimaryKey(assistantId);
        return userLoginForm;
    }
}
